<section class="card manual">

    <div class="card-header">
        <filter-list request="request" callback="loadFiles(pageIndex)"></filter-list>
    </div>
    <div class="card-body">
        <table class="table table-sm table-hover" cellspacing="0">
            <thead class="thead-light">
                <tr>
                    <th scope="col" width="30%">
                        Name
                    </th>
                    <th scope="col">
                        WebPath
                    </th>
                    <th scope="col" width="15%">
                        Preview
                    </th>
                    <th scope="col" width="5%" class="text-right">
                        Actions
                    </th>
                </tr>
            </thead>

            <tbody class="sortable" ng-init="loadFiles()">
                <tr ng-repeat="d in data.directories track by $index">
                    <td class="text-primary">
                        <span class="fas fa-folder mr-2"></span>
                        <a ng-click="loadPage(d)" class="btn btn-sm text-primary" ng-bind="d"></a>
                    </td>
                    <td colspan="3"></td>
                </tr>
                <tr ng-repeat="item in data.files track by $index" class="sortable-item" sort-model="file"
                    sort-model-id="{{item.id}}">
                    <td>
                        <span ng-bind="item.fileName"></span>
                    </td>
                    <td>
                        <div class="input-group input-group-sm">
                            <input id="path-modal-{{$index}}" value="{{item.webPath}}" onclick="this.select()" class="form-control form-control-sm"
                                readonly="readonly">
                            <div class="input-group-append">
                                <button class="btn btn-outline-secondary btn-clipboard" type="button"
                                    data-clipboard-target="#path-modal-{{$index}}"><i class="mi mi-Copy"></i></button>
                            </div>
                        </div>
                    </td>
                    <td>
                        <!--<img imageonload src="{{item.fullPath}}" height="50" />-->
                    </td>
                    <td>
                        <div class="btn-group btn-group-sm btn-group-sm float-right" role="group" aria-label="Actions">
                            <a href="/portal/file/details?folder={{item.fileFolder}}&filename={{item.fileName}}{{item.extension}}"
                                class="btn btn-light">
                                <span class="fa fa-pen text-primary"></span>
                            </a>
                            <a href="{{item.webPath}}" target="_blank" class="btn btn-light">
                                <span class="fa fa-eye text-primary"></span>
                            </a>

                            <button type="button" class="btn btn-light del-popover" ng-click="removeFile(item.id)">
                                <span class="fa fa-times text-danger"></span>
                            </button>
                            <div class="popover-body d-none">
                                <a href="/{{currentLanguage}}/portal/files/delete/{{item.id}}" class="btn btn btn-danger">Yes,
                                    I want to delete!</a>
                            </div>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="card-footer">
        <paging class="small" page="data.page" page-size="data.pageSize" total="data.totalItems" ul-class="pagination justify-content-end"
            a-class="page-link" paging-action="loadFiles(page-1)" scroll-top="true">
    </div>
</section>
